//
//  TransfortService.swift
//  TestBankActor
//
//  Created by 罗万能 on 2025/6/17.
//

import Foundation
import SwiftData
actor TransfortService{
    func trans(from :BankAccount ,to :BankAccount ,amount :Double) async{
        if await from.withdraw(amount: amount){
            try! await Task.sleep(nanoseconds: 2_000_000)
            await to.deposit(amount: amount)
        }else{
//            await from.deposit(amount: amount)
        }
    }
}

//@ModelActor actor sss{
//    
//}
//let s = sss(modelContainer: <#T##ModelContainer#>)
